const NodePolyfillPlugin = require('node-polyfill-webpack-plugin')
const TransformPages = require('uni-read-pages')
const {
	webpack
} = new TransformPages()
module.exports = {
	transpileDependencies: ['uview-ui'],
	configureWebpack: {
		performance: {
			hints: false
		},
		devServer: {
			// 解决页面弹出红色报错遮罩层
			client: {
				//将overlay设置为false即可
				overlay: false,
			},
		},
		plugins: [
			new webpack.DefinePlugin({
				ROUTES: webpack.DefinePlugin.runtimeValue(() => {
					const tfPages = new TransformPages({
						includes: ['path', 'name', 'aliasPath', 'meta']
					});
					return JSON.stringify(tfPages.routes)
				}, true)
			}),
			new NodePolyfillPlugin()
		]
	}
}